from database.models import Users
import json
import hashlib
from django.http import HttpRequest, JsonResponse, HttpResponse


def signin(request: HttpRequest):
    payload = json.loads(request.body)
    passwd_md5 = hashlib.md5(payload['passwd'].encode()).hexdigest()
    Users.objects.create(user_name=payload['name'], user_passwd_hash=passwd_md5, tele=payload['tele'])
    return HttpResponse('success')

# def set_avatar(request: HttpRequest):
